package com.xishu.entity.shop;

import com.xishu.annotation.oplog.OplogAnnotation;
import com.xishu.entity.AbstractEntity;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;

/**
 * 餐桌
 * <p>
 * 一个餐桌至少要保留一条记录，这条记录相当于是模板，保持不变
 * <p>
 * 模板是由餐桌的配置来生成的
 * 模板用在B端前台显示用的
 * 如果开台过后，就会新添加一条记录，并且模板属性是为false的
 */
@Entity(name = "food_table")
@Table(indexes = {@Index(columnList = "shopId")})
public class FoodTable extends AbstractEntity {
    private static final long serialVersionUID = -4523060997110618700L;

    @ApiModelProperty(value = "归属的分店")
    private Long shopId;

    @ApiModelProperty(name = "餐桌编码，比如A1,B1,A2")
    @OplogAnnotation(fieldName = "餐桌编码")
    private String code;

    @ApiModelProperty(name = "餐桌编码，比如A,B,C")
    @OplogAnnotation(fieldName = "餐桌编码")
    private String typeCode;

    @ApiModelProperty(name = "餐桌内部唯一编码, 只要有开台，就会多生一个唯一编码，哪怕只有一桌")
    private Integer uniqueCode;

    @ApiModelProperty(name = "剩余多少人,只有模板才需要")
    @OplogAnnotation(fieldName = "剩余多少人")
    private Integer leftPersons;

    @ApiModelProperty(name = "状态, 1空桌，2是就餐中，3已部分买单,4已部分发送")
    @OplogAnnotation(fieldName = "状态")
    private Integer status;

    @ApiModelProperty(name = "是否是模板,模板是由餐桌的配置来生成的,模板用在B端前台显示用的,如果开台过后，就会新添加一条记录，并且模板属性是为false的")
    @OplogAnnotation(fieldName = "是否是模板")
    private Boolean template;

    @ApiModelProperty(name = "行号")
    @Column(name = "f_row")
    @OplogAnnotation(fieldName = "行号")
    private Integer row;

    @ApiModelProperty(name = "列号")
    @Column(name = "f_column")
    @OplogAnnotation(fieldName = "列号")
    private Integer column;

    @ApiModelProperty(name = "就餐人数, 开台拼桌的时候填写")
    @OplogAnnotation(fieldName = "就餐人数")
    private Integer diners;

    @ApiModelProperty(name = "场景值")
    @OplogAnnotation(fieldName = "场景值")
    private Long sceneId;

    @ApiModelProperty(name = "默认餐桌，用来扫描二维码使用,跟场景没有关系")
    @OplogAnnotation(fieldName = "默认餐桌")
    private Boolean defaultFoodTable;

    @ApiModelProperty(value = "是否上线显示")
    @OplogAnnotation(fieldName = "是否上线显示")
    private Boolean online;

    @ApiModelProperty(value = "服务员姓名")
    @OplogAnnotation(fieldName = "服务员姓名")
    private String waiterName;

    @ApiModelProperty(value = "服务员账号ID")
    @OplogAnnotation(fieldName = "服务员账号ID")
    private Long waiterId;

    @ApiModelProperty(value = "餐桌的显示号码")
    private Integer showNo;

    @ApiModelProperty(value = "是否已经发送到厨房了")
    private Boolean sendPrinter;

    @Transient
    @ApiModelProperty(value = "是否删除订单，默认是false，也就是要删除订单")
    public Boolean notDeleteOrder;

    @ApiModelProperty
    @Transient
    private Boolean queryCanCheckout;

    @ApiModelProperty(value = "是否可以结账")
    private Boolean canCheckout;

    @ApiModelProperty(value = "相关的订单ID，为了固定餐桌处理")
    private Long relateOrderId;

    public Boolean getQueryCanCheckout() {
        return queryCanCheckout;
    }

    public void setQueryCanCheckout(Boolean queryCanCheckout) {
        this.queryCanCheckout = queryCanCheckout;
    }

    public Long getRelateOrderId() {
        return relateOrderId;
    }

    public void setRelateOrderId(Long relateOrderId) {
        this.relateOrderId = relateOrderId;
    }

    public Boolean getCanCheckout() {
        return canCheckout;
    }

    public void setCanCheckout(Boolean canCheckout) {
        this.canCheckout = canCheckout;
    }

    public Boolean getNotDeleteOrder() {
        return notDeleteOrder;
    }

    public void setNotDeleteOrder(Boolean notDeleteOrder) {
        this.notDeleteOrder = notDeleteOrder;
    }

    public Boolean getSendPrinter() {
        return sendPrinter;
    }

    public void setSendPrinter(Boolean sendPrinter) {
        this.sendPrinter = sendPrinter;
    }

    public String getWaiterName() {
        return waiterName;
    }

    public void setWaiterName(String waiterName) {
        this.waiterName = waiterName;
    }

    public Long getWaiterId() {
        return waiterId;
    }

    public void setWaiterId(Long waiterId) {
        this.waiterId = waiterId;
    }

    public Boolean getOnline() {
        return online;
    }

    public void setOnline(Boolean online) {
        this.online = online;
    }

    public Long getSceneId() {
        return sceneId;
    }

    public void setSceneId(Long sceneId) {
        this.sceneId = sceneId;
    }

    public Integer getDiners() {
        return diners;
    }

    public void setDiners(Integer diners) {
        this.diners = diners;
    }

    public Integer getUniqueCode() {
        return uniqueCode;
    }

    public void setUniqueCode(Integer uniqueCode) {
        this.uniqueCode = uniqueCode;
    }

    public Integer getRow() {
        return row;
    }

    public void setRow(Integer row) {
        this.row = row;
    }

    public Integer getColumn() {
        return column;
    }

    public void setColumn(Integer column) {
        this.column = column;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getLeftPersons() {
        return leftPersons;
    }

    public void setLeftPersons(Integer leftPersons) {
        this.leftPersons = leftPersons;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public Boolean getTemplate() {
        return template;
    }

    public void setTemplate(Boolean template) {
        this.template = template;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public Boolean getDefaultFoodTable() {
        return defaultFoodTable;
    }

    public void setDefaultFoodTable(Boolean defaultFoodTable) {
        this.defaultFoodTable = defaultFoodTable;
    }

    public Integer getShowNo() {
        return showNo;
    }

    public void setShowNo(Integer showNo) {
        this.showNo = showNo;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("FoodTable{");
        sb.append("shopId=").append(shopId);
        sb.append(", id='").append(id).append('\'');
        sb.append(", code='").append(code).append('\'');
        sb.append(", typeCode='").append(typeCode).append('\'');
        sb.append(", uniqueCode=").append(uniqueCode);
        sb.append(", leftPersons=").append(leftPersons);
        sb.append(", status=").append(status);
        sb.append(", template=").append(template);
        sb.append(", row=").append(row);
        sb.append(", column=").append(column);
        sb.append(", diners=").append(diners);
        sb.append(", sceneId=").append(sceneId);
        sb.append(", defaultFoodTable=").append(defaultFoodTable);
        sb.append(", online=").append(online);
        sb.append(", waiterName='").append(waiterName).append('\'');
        sb.append(", waiterId=").append(waiterId);
        sb.append(", showNo=").append(showNo);
        sb.append('}');
        return sb.toString();
    }
}
